﻿
/****** Object:  Table [dbo].[House]    Script Date: 6/29/2013 8:40:28 PM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[House](
	[HouseId] [int] IDENTITY(1,1) NOT NULL,
	[ContactInfoId] [int] NOT NULL,
	[OwnerId] [int] NOT NULL,
	[Pets] [nvarchar](500) NULL,
	[HasDogs] [bit] NOT NULL,
	[HasCats] [bit] NOT NULL,
	[HasExoticAnimals] [bit] NOT NULL,
	[HouseType] [nvarchar](250) NOT NULL,
	[Rooms] [int] NULL,
	[PreferredAge] [nvarchar](250) NULL,
	[PreferredMarried] [bit] NULL,
	[PreferredGender] [bit] NULL,
	[HouseDescription] [nvarchar](max) NULL,
	[DateAvailableFrom] [date] NOT NULL,
	[DateAvailableTo] [date] NOT NULL,
 CONSTRAINT [PK_House] PRIMARY KEY CLUSTERED 
(
	[HouseId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

ALTER TABLE [dbo].[House]  WITH CHECK ADD  CONSTRAINT [FK_House_ContactInfo] FOREIGN KEY([ContactInfoId])
REFERENCES [dbo].[ContactInfo] ([ContactInfoId])
GO

ALTER TABLE [dbo].[House] CHECK CONSTRAINT [FK_House_ContactInfo]
GO

ALTER TABLE [dbo].[House]  WITH CHECK ADD  CONSTRAINT [FK_House_Owner] FOREIGN KEY([OwnerId])
REFERENCES [dbo].[Owner] ([OwnerId])
GO

ALTER TABLE [dbo].[House] CHECK CONSTRAINT [FK_House_Owner]
GO

